/**
 * Project Name:bfs_v1.0.1
 * File Name:ButtonController.java
 * Package Name:com.zeei.bfs.controller
 * Date:2016年12月22日下午4:34:37
 * Copyright (c) 2016, ZEEI All Rights Reserved. *
 *
 * ClassName:ButtonController 
 * Function: TODO ADD FUNCTION.  
 * @author   zws 
 * @since    JDK 1.8	 
 */

package com.zeei.bfs.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zeei.bfs.service.ButtonService;
import com.zeei.bfs.vo.ButtonVO;
import com.zeei.common.controller.BasicController;
import com.zeei.common.utils.SessionInfoUtil;
import com.zeei.common.vo.ResultDataVO;
import com.zeei.common.vo.UserVO;

@Controller
@RequestMapping("/bfs/button")
public class ButtonController extends BasicController{
	
	@Resource
	private ButtonService buttonService;
	
	@RequestMapping(value = "/list", method = RequestMethod.POST)
	@ResponseBody
	public ResultDataVO<Map<String,Object>> queryMenu(Integer menuId) {
		UserVO user = SessionInfoUtil.getSessionUserInfo();
		
		List<ButtonVO> buttons = buttonService.queryButton(menuId);
		List<ButtonVO> operButtons=buttonService.queryUserButton(menuId,user.getUserid());
		Map<String, Object> resultMap=new HashMap<String,Object>();
		resultMap.put("buttons", buttons);
		resultMap.put("operButtons", operButtons);
		return this.createResultDataVO(resultMap, true, null);
	}
}

